A network device that is attached to a network must know when new data has arrived. However, due to the fact that the network device is usually performing some task or executing some application, it is not normally free to wait on the arrival of new data. The network device must depend on a network interface device or the network device must periodically check for the arrival of new data. If the network device is not notified about or if it does not check for the arrival of new data, the new data may sit in storage for extended periods of time, possibly resulting in the loss of some data due to a storage buffer overrun. Additionally, if the network device does not know about the arrival of new data, applications that need the new data will not be provided the new data and the application's overall performance will suffer.
There are several widely used techniques for detecting the presence of new data, including microprocessor interrupts and polling. Techniques using microprocessor interrupts depend on a network interface device, such as a modem or a network interface card, to assert a microprocessor interrupt whenever the network interface device receives data from the network. When the network device's microprocessor receives the microprocessor interrupt, it will put aside whatever it is currently doing and process the new data. Alternatively, in techniques that use polling, the network device's own microprocessor periodically stops whatever it is doing and checks a special memory location, commonly referred to as a shared variable, to see if new data has arrived. The special memory location is called the shared variable because multiple devices (the network device and the network interface device) have access, both read and write, to the memory location. The network interface device, upon receipt of new data, will change the value stored in the shared variable, signifying the arrival of new data. The network device's microprocessor, upon checking the shared variable, will see that it has been changed and know that new data has arrived.
Techniques that use microprocessor interrupts and/or polling can have significant disadvantages. Whenever the network device's microprocessor receives a microprocessor interrupt, it must stop whatever application it is executing to process the interrupt. To be able to return to what it was doing, the microprocessor must save its state, i.e., the microprocessor must save all of its register values, and swap out the application it was executing to memory, and then process the data. The process of saving state followed by the changing of applications is often referred to as a context switch. After the microprocessor finishes processing the data, the application that was swapped out restored, the state of the microprocessor must be restored, and then the microprocessor can return to executing the application.
In polling, the microprocessor must periodically check the shared variable to see if new data has arrived. Before the microprocessor can perform the polling operation, it must also perform a context switch. After the microprocessor completes the polling operation, it must perform another context switch to return to its pre-polling state.
In high-performance networks which also guarantee a certain minimum level of performance for network connections, such as an Asynchronous Transfer Mode (ATM) network, the context switches associated with frequent microprocessor interrupts and polling can take a heavy toll on the performance of the network device. If microprocessor interrupts or polling occurs too frequently, a large amount of time will be wasted performing context switches. However, if microprocessor interrupts or polling occurs too infrequently, then the minimum level of performance may not be met and the network does not perform to specifications.
The use of microprocessor interrupts and polling requires that network performance guarantees be balanced with overall loading on the network device's microprocessor. For example, if microprocessor interrupts are used, then the amount of new data received should exceed a certain threshold before an interrupt is asserted. Otherwise, the time spent in the context switches required to process the interrupts could overload the microprocessor, greatly reducing the microprocessor's ability to perform other work. However, if the threshold is set too large, i.e., a large amount of new data must be received before the microprocessor interrupt is asserted, then the latency for processing early arriving data (new data whose arrival did not exceed the threshold) may exceed the guaranteed latency requirements. A similar situation occurs with polling, where if too much time is allowed to elapse between polling events, then the latency for processing the data may exceed the guaranteed latency requirements. On the other hand, if the polling period is too small and polling occurs too frequently, then the time spent in the context switches required to perform polling would overload the microprocessor. A need has therefore arisen for a technique supporting information transfers in a network that is capable of meeting bandwidth and latency guarantees and does not place an undo burden on the network device's microprocessor.